// app/api/card/[id]/route.ts
import { getItemById } from '@/mock/data';
import { NextResponse } from 'next/server'
export const dynamic = 'force-dynamic';


export async function GET(
    request: Request,
    { params }: { params: { id: string } }
) {
    try {
        const { id } = params

        if (!id || typeof id !== 'string') {
            return NextResponse.json(
                { error: '无效的请求参数', details: 'ID必须是字符串' },
                { status: 400 }
            )
        }

        const card = getItemById(id)
        return NextResponse.json({ success: true, data: card })

    } catch (err) {
        return NextResponse.json(
            {
                error: '服务器内部错误',
            }
        )
    }
}
